#Contributed by Tuukka Ojala <tuukka.ojala@gmail.com>

import ctypes

def init_speech():
 global client
 client = ctypes.windll.LoadLibrary("speech/nvdaControllerClient32.dll")

def speak (message, interrupt=True):
 if type(message) in (str, str):
  message = unicode (message, "ISO-8859-1")

 if interrupt == True:
  client.nvdaController_cancelSpeech()
  client.nvdaController_speakText(message)
 else:
  client.nvdaController_speakText(message)
